﻿using CommunityToolkit.Mvvm.ComponentModel;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Zo.ExcelBox.Models
{
    /// <summary>
    /// 数据映射模版
    /// </summary>
    public class MapTemplate : TableBase
    {
     
        private string _name = string.Empty;
        /// <summary>
        /// 模版名
        /// </summary>
        [SqlSugar.SugarColumn(Length = 50, IsNullable = false)]
        public string Name
        {
            get => _name;
            set => SetProperty(ref _name, value);
        }


        /// <summary>
        /// 映射的模版配置 
        /// </summary>
        [SqlSugar.SugarColumn(ColumnDataType = "TEXT", IsJson = true)]
        public List<MapTemplate_Config> Template { get; set; } = new List<MapTemplate_Config>();
    }

    /// <summary>
    /// 模版配置数据
    /// </summary>
    public class MapTemplate_Config : ObservableObject
    {
        private string _source = string.Empty;
        /// <summary>
        /// 源字段名
        /// </summary>
        public string Source
        {
            get => _source;
            set => SetProperty(ref _source, value);
        }

        private string _target = string.Empty;
        /// <summary>
        /// 转换后的目标字段名
        /// </summary>
        public string Target
        {
            get => _target;
            set => SetProperty(ref _target, value);
        }
    }
}
